package com.memory.test.service.impl;

import com.memory.test.mbg.mapper.MUsersMapper;
import com.memory.test.mbg.model.MUsers;
import com.memory.test.mbg.model.MUsersExample;
import com.memory.test.service.MUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MUserServiceImpl implements MUserService {
    @Autowired
    private MUsersMapper mUsersMapper;

    @Override
    public MUsers getUserByUsreName(String username) {
        MUsersExample example=new MUsersExample();
        MUsersExample.Criteria criteria = example.createCriteria();
        criteria.andUsernameEqualTo(username);
        List<MUsers> mUsers = mUsersMapper.selectByExample(example);
        if(mUsers.size()>0){
            return mUsers.get(0);
        }
        return null;
    }
}
